﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JotCMS;

namespace JotCMS
{
    public partial class JotEditContent : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString.Count > 0 && Request.QueryString["c"] != null)
            {
                ContentName.Value = Request.QueryString["c"].ToString();
                Jot jot = new Jot();
                jot.CurrentJotMode = Jot.JotMode.Edit;
                JotContentItem item = jot.GetJotContent(ContentName.Value);
                txtDefaultHtmlArea.InnerText = item.PublishedContent;
                if(item.Updated != DateTime.MinValue)
                    Updated.Text = item.Updated.ToString();
                UdpatedBy.Text = item.UpdatedBy;
                if (item.Created != DateTime.MinValue)
                    Created.Text = item.Created.ToString();
                CreatedBy.Text = item.CreatedBy;

                if (!JotCMSConfiguration.GetConfig().Cache)
                {
                    ItemCacheLI.Visible = false;
                    AllCacheLI.Visible = false;
                }
            }
        }
    }
}